<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class psetting_model extends CI_Model {

	public function index()
	{
		$query = $this->db->get('server');
		return $query->result_array();
	}

	public function get_web_service()
	{
		$query = $this->db->get('web_service');
		return $query->result_array();
	}

	public function add_web_service($web_service)
	{
		$this->db->insert('web_service',$web_service);
	}

	public function update_web_service($web_service)
	{
		$this->db->where('web_id',1);
		$this->db->update('web_service',$web_service);
	}

	public function get_vdo()
	{
		$query = $this->db->get('vdo');
		return $query->result_array();
	}

	public function get_server()
	{
		$this->db->select('server_id');
		$query = $this->db->get('server');
		return $query->result_array();
	}

	public function find_server($input)
	{
		$this->db->where('server_id' ,$input['server_id']);
		$query = $this->db->get('server');
		return $query->result_array();
	}

	public function sum_vdofile()
	{
		$this->db->select_sum('vdo_size');
		$query = $this->db->get('vdo');
		return $query->result_array();
	}

	public function add_stream_server($input)
	{
		$this->db->insert('server' ,$input);
	}

	public function update_stream_server($input)
	{
		$this->db->where('server_id' ,$input['server_id']);
		$this->db->update('server' ,$input);
	}

	public function remove_server($input)
	{
		$this->db->where('server_id' ,$input['server_id']);
		$this->db->delete('server');
	}
	
}